package main

import (
	"fmt"
	"gitee.com/inteface.demon/pbjson/pb"
	"github.com/golang/protobuf/jsonpb"
)

func main() {
	tch := pb.Teacher{
		Name:                 "sobot",
	}
	m := jsonpb.Marshaler{
		EmitDefaults: true, // 是否呈现0值的状态
		OrigName:     true,
		EnumsAsInts:  true,	//枚举指定为整数
	}
	s,_:=m.MarshalToString(&tch)
	fmt.Println(s)
	var techer pb.Teacher
	jsonpb.UnmarshalString(s,&techer)

	fmt.Println(techer.Name,techer.Age)
}
